mode(-1);
SCICOM=get_absolute_file_path('loader.sce');
chdir(SCICOM);
if part(SCICOM,length(SCICOM))=='\' then
  SCICOM=part(SCICOM,1:length(SCICOM)-1);
end
if isdir('help') then
	chdir('help');
	exec('loadhelp.sce');
	chdir('..');
end
ver=getversion();
if ver=='scilab-4.1.2' then 
//Add scicom palette for scilab 4.1.2
scicom_pal=[
'Scicom_Basic',SCICOM+'/palettes/Scicom_Basic.cos',
'Scicom_Filter',SCICOM+'/palettes/Scicom_Filter.cos',
'Scicom_Modulation&DemodulationAnalog',SCICOM+'/palettes/Scicom_ModDemodA.cos',
'Scicom_Modulation&DemodulationDigital',SCICOM+'/palettes/Scicom_ModDemodD.cos',
'Scicom_Modulation&DemodulationOthers',SCICOM+'/palettes/Scicom_ModDemodO.cos',
'Scicom_ChannelCoding',SCICOM+'/palettes/Scicom_ChannalCoding.cos',
'Scicom_Misc',SCICOM+'/palettes/Scicom_misc.cos',
'Scicom_ErrorControlCoding', SCICOM+'/palettes/Scicom_ErrorControlCoding.cos'
];
predef('c');
for ii=1:size(scicom_pal,1)
  kk = find(scicos_pal(:,1)==scicom_pal(ii,1));
  if kk<>[] then
    scicos_pal(kk,2)=scicom_pal(ii,2);
  else
    scicos_pal=[scicos_pal;scicom_pal(ii,:)];
  end
end
clear ii;
clear kk;
elseif ver=='4.3' then
//Add scicom palette for scicoslab 4.3
scicom_pal=[
'Scicom_Basic',SCICOM+'/palettes/Palettes4Scicoslab4.3/Scicom_Basic.cos',
'Scicom_Filter',SCICOM+'/palettes/Palettes4Scicoslab4.3/Scicom_Filter.cos',
'Scicom_Modulation&Demodulation',SCICOM+'/palettes/Palettes4Scicoslab4.3/Scicom_ModDemod.cos',
'Scicom_PAM',SCICOM+'/palettes/Palettes4Scicoslab4.3/Scicom_PAM.cos',
'Scicom_SourceCoding',SCICOM+'/palettes/Palettes4Scicoslab4.3/Scicom_Source_Coding.cos',
'Scicom_ChannelCoding',SCICOM+'/palettes/Palettes4Scicoslab4.3/Scicom_Channal_Coding.cos',
];
predef('c');
for ii=1:size(scicom_pal,1)
  kk = find(scicos_pal(:,1)==scicom_pal(ii,1));
  if kk<>[] then
    scicos_pal(kk,2)=scicom_pal(ii,2);
  else
    scicos_pal=[scicos_pal;scicom_pal(ii,:)];
  end
end
clear ii;
clear kk;
else
printf('=================================================================\n');
printf('     Sorry, your Scilab version is currently not supported.\n');
printf('  Scicom is now supported only on Scilab-4.1.2 and ScicosLab-4.3.\n');
printf('=================================================================\n');
end
